var confLog = {
    socket: null,
    username: null,
    _log(menuId, title, descr) {
        let data = {}
        data.menuId = menuId
        data.descr = descr
        data.title = title
        if (this.socket) {
            let msg = {
                method:'log',
                username:this.username,
                log:data
            }
            this.socket.send(JSON.stringify(msg))
        }
    }
}

/**
 * 设置回调发送消息的方法
 * @param callback
 */
confLog.init = function (websocket, username) {
    this.socket = websocket
    this.username = username
}

/**
 * 开始会议日志
 * @param meetingName
 */
confLog.vconfStart = function(meetingName){
    this._log('10205','${i18n.start_conference}','${i18n.start_conference}=>[ ${i18n.conference_name}: '+meetingName+' ]')
}

confLog.vconfStop = function(meetingName){
    this._log('10206','${i18n.close_conference}','${i18n.close_conference}=>[ ${i18n.conference_name}: '+meetingName+' ]')
}

confLog.vconfMute = function(meetingName, memberName) {
    this._log('10203', '${i18n.conference_silence}', '${i18n.conference_silence}=>[ ${i18n.called_number}: ' + memberName + ' ${i18n.conference_name}: ' + meetingName+' ]')
}

confLog.vconfUnmute = function(meetingName, memberName) {
    this._log('10203', '${i18n.cancel_silence}', '${i18n.cancel_silence}=>[ ${i18n.called_number}: ' + memberName + ' ${i18n.conference_name}: ' + meetingName+' ]')
}

confLog.vconfMuteAll = function(meetingName) {
    this._log('10204', '${i18n.conference_all_silence}', '${i18n.conference_all_silence}=>[ ${i18n.conference_name}: ' + meetingName + ' ]')
}

confLog.vconfUnmuteAll = function(meetingName) {
    this._log('10204', '${i18n.cancel_all_silence}', '${i18n.cancel_all_silence}=>[ ${i18n.conference_name}: ' + meetingName + ' ]')
}

confLog.vconfMuteVideo = function(meetingName, memberName) {
    this._log('10203', '${i18n.conference_silence_video}', '${i18n.conference_silence_video}=>[ ${i18n.called_number}: ' + memberName + ' ${i18n.conference_name}: ' + meetingName+' ]')
}

confLog.vconfUnmuteVideo = function(meetingName, memberName) {
    this._log('10203', '${i18n.cancel_silence_video}', '${i18n.cancel_silence_video}=>[ ${i18n.called_number}: ' + memberName + ' ${i18n.conference_name}: ' + meetingName+' ]')
}

confLog.vconfJoin = function(meetingName, memberName) {
    this._log('10201', '${i18n.join_conference}', '${i18n.joined_conference}=>[ ${i18n.called_number}: ' + memberName + '  ${i18n.conference_name}: ' + meetingName+' ]')
}

confLog.vconfLeave = function(meetingName, memberName) {
    this._log('10202', '${i18n.remove_conference}', '${i18n.remove_conference}=>[ ${i18n.called_number}: ' + memberName + '  ${i18n.conference_name}: ' + meetingName+' ]')
}

confLog.vconfMulti = function(meetingName) {
    this._log('10112', '${i18n.many_party_conference}', '${i18n.many_party_conference}=>[ ${i18n.conference_name}: ' + meetingName+' ]')
}

confLog.vconfStartRecord = function(meetingName) {
    this._log('10203', '${i18n.conference_record}', '${i18n.conference_start_record}=>[ ${i18n.conference_name}: ' + meetingName+' ]')
}

confLog.vconfStopRecord = function(meetingName) {
    this._log('10203', '${i18n.conference_record}', '${i18n.conference_stop_record}=>[ ${i18n.conference_name}: ' + meetingName+' ]')
}
/**
 * webrtc直呼日志
 * @param caller,callee
 */
confLog.sendCall = function(caller,callee) {
    this._log('10104', '${i18n.call}', "${i18n.call}=>" +"[ ${i18n.caller_number}: "+caller+" ${i18n.called_number}: " + callee+" ]")
}